#ifndef NETWORKMGR_H
#define NETWORKMGR_H


#include <QNetworkAccessManager>
#include <QtNetwork>
#include <QJsonObject>
#include <QDebug>
#include "HttpWorker.h"

#include "NetWorkMgr_global.h"

class NETWORKMGR_EXPORT NetWorkMgr :public QObject
{
    Q_OBJECT
public:
    NetWorkMgr();
    virtual ~NetWorkMgr();

    static NetWorkMgr& instance();

    //直接调用接口，
    void Login(const QJsonObject & jsParam, const QString & strTask);

    void GetPerosnInfoList(const QJsonObject & jsParam, const QString & strTask);

private:
    void initNetwork(const QString & strIp, const QString & strPort);

private slots:
    void requestLoginFinished(QByteArray responseData);
    void requestGetPersonInfoListFinished(QByteArray responseData);
signals:
    void LoginDone(const QJsonObject &jsResult);
    void GetPersonInfoListDone(const QJsonObject &jsResult);

private:
    QString m_strIp;
    QString m_strPort;
    QThreadPool pool;
};

#endif // NETWORKMGR_H
